<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>账户开户</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/animate.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/bootstrap-fileinput/fileinput.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/jQuery-Validation/css/validationEngine.jquery.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/accountadd.css" rel="stylesheet">
    <style type="text/css">
        
        body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}
        #l-map{height:700px;width:100%;}
        #r-result{width:100%;}
	  *{
	      margin:0px;
	      padding:0px;
	  }
	  body, button, input, select, textarea {
	      font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
	  }
	  p{
	      width:603px;
	      padding-top:3px;
	      overflow:hidden;
	  }
	  #container{
	    margin-top:50px;
	   	width:100%;
	    min-height:767px;
	    }
    </style>
</head>
<body class="gray-bg">
<ul id="myTab" class="nav nav-tabs">
	<li class="active">
		<a href="#home" data-toggle="tab">对公账户</a>
	</li>
	<li><a href="#ios" data-toggle="tab">对私账户</a></li>
</ul>
    <div class="container Account" style="margin-top: 50px">
        <form class="form-horizontal" role="form" id="accountPublic" enctype="multipart/form-data" autocomplete="off">
                <div class="col-xs-12 col-md-12">
                	<div class="form-group">
	                    <label class="col-sm-3 control-label">企业名称:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]"
	                               name="comnumName" id="comnumName" placeholder="企业名称">
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">企业统一信用代码:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumLicenceCode" 
	                        	id="comnumLicenceCode" placeholder="企业统一信用代码">
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">企业银行账号:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumBankCard" 
	                        	id="comnumBankCard" placeholder="企业银行账号">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">开户行联行行号:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumInterBankNo" 
	                        	id="comnumInterBankNo" placeholder="开户行联行行号">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">开户行:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumBankName" 
	                        	id="comnumBankName" placeholder="开户行">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">开户行地址:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumBankArea" 
	                        	id="comnumBankArea" placeholder="开户行地址">	
	                    </div>
	                </div>
	              <div class="form-group" style="margin-top50px;">
	                  <div class="col-sm-12 control-label" style="text-align:center;">
	                      <button type="button" class="btn btn-default" onclick="closeForm();">关闭</button>
	                       &nbsp;&nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-primary"  id="save" >保存</button>
	                  </div>
	              </div>
             </div> 
         </form>
    </div>
    <!-- 对私账户 -->
    <div class="container Account" style="margin-top: 50px; display:none;">
        <form class="form-horizontal" role="form" id="accountPerson" enctype="multipart/form-data">
                <input type="hidden" name="comnumId" id="companyId">
                <div class="col-xs-12 col-md-12">
                	<div class="form-group">
	                    <label class="col-sm-3 control-label">持卡人姓名:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumBankHolder" 
	                        	id="comnumBankHolder" placeholder="持卡人姓名">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">身份证号:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumIdCard" 
	                        	id="comnumIdCard" placeholder="身份证号">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">手机号:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumPhone" 
	                        	id="comnumPhone" placeholder="手机号">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">银行卡号:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumBankCard" 
	                        	id="comnumBankCard" placeholder="银行卡号">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label">开户行:</label>
	                    <div class="col-sm-7">
	                        <input type="text" class="form-control validate[required]" name="comnumBankName" 
	                        	id="comnumBankName" placeholder="开户行">	
	                    </div>
	                </div>
	              <div class="form-group" style="margin-top50px;">
	                  <div class="col-sm-12 control-label" style="text-align:center;">
	                      <button type="button" class="btn btn-default" onclick="closeForm();">关闭</button>
	                       &nbsp;&nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-primary"  id="save" >保存</button>
	                  </div>
	              </div>
             </div>  
         </form>
    </div>
<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/js/content.min.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/js/public/ttbj-core.js"></script>
<script src="${pageContext.request.contextPath}/jQuery-Validation/js/jquery.validationEngine.js"></script>
<script src="${pageContext.request.contextPath}/jQuery-Validation/js/jquery.validationEngine-zh_CN.js"></script>
<script src="${pageContext.request.contextPath}/laydate5.0.7/laydate.js"></script>
</body>
<script>
		var comnumId;	
		var comnumNum;
        $(function () {
        	comnumId = $.getUrlParam("comnumId");
        	comnumNum = $.getUrlParam("comnumNum");
        	 $('#accountPublic').validationEngine('attach', {
        	        validationEventTrigger : 'blur',	//当提交的时候验证是否合法
        	        promptPosition: 'inline',
        	        scroll: false,
        	        focusFirstField : true,
        	        onValidationComplete : function (form, valid) {
        	        	if(valid){
        	        		addaccpublic();
        	        	}
        	        }
        	    });
        	 $('#accountPerson').validationEngine('attach', {
     	        validationEventTrigger : 'blur',	//当提交的时候验证是否合法
     	        promptPosition: 'inline',
     	        scroll: false,
     	        focusFirstField : true,
     	        onValidationComplete : function (form, valid) {
     	        	if(valid){
     	        		addaccperson();
     	        	}
     	        }
     	    });
            $("#myTab li").click(function () {
                $(".Account").eq($(this).index()).show().siblings(".Account").hide();
            });
        })
        //关闭窗口
       	function closeForm() {
		    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		    parent.layer.close(index);
		}
      //增加
	   function addaccpublic() {
	    $.ajax({
	        url: "../driver/addToShortDriverInfo.htm",
	        cache: false,
	        type: "post",
	        dataType: "json",
	        data: $("#accountPublic").serialize()+"&comnumId="+comnumId+"&comnumNum="+comnumNum,
	        beforeSend:function(){var index = layer.load(1, { shade: [0.8,'#ddd']});},
	        complete:function(){var index = layer.closeAll("loading");},
	        success: function (result) {
	            if (result.status == 0) {
	                parent.layer.msg(result.message, {icon: 1});
	                parent.$table.bootstrapTable('refresh', {url: '../company/getCompanyPage.htm'});
	                closeForm();
	            } else {
	                parent.layer.msg(result.message, {icon: 2});
	                closeForm();
	            }
	        }
	    });
	}
	   function addaccperson() {
		    $.ajax({
		        url: "../driver/addToShortDriverInfo.htm",
		        cache: false,
		        type: "post",
		        dataType: "json",
		        data: $("#accountPerson").serialize()+"&comnumId="+comnumId+"&comnumNum="+comnumNum,
		        beforeSend:function(){var index = layer.load(1, { shade: [0.8,'#ddd']});},
		        complete:function(){var index = layer.closeAll("loading");},
		        success: function (result) {
		            if (result.status == 0) {
		                parent.layer.msg(result.message, {icon: 1});
		                parent.$table.bootstrapTable('refresh', {url: '../company/getCompanyPage.htm'});
		                closeForm();
		            } else {
		                parent.layer.msg(result.message, {icon: 2});
		                closeForm();
		            }
		        }
		    });
		}
    </script>
</html>